package com.gy.universities.service.impl;
import com.gy.universities.dao.StudySchoolMapper;
import com.gy.universities.entity.StudySchool;
import com.gy.universities.service.StudySchoolService;
///import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;

@Component
@Service
public class StudySchoolServiceImpl implements StudySchoolService {

    @Resource
    private StudySchoolMapper studySchoolMapper;

    public StudySchool getStudySchoolById(String id)throws Exception{
        return studySchoolMapper.getStudySchoolById(id);
    }

    public List<StudySchool>	getStudySchoolListByMap(Map<String,Object> param)throws Exception{
        return studySchoolMapper.getStudySchoolListByMap(param);
    }

    public Integer getStudySchoolCountByMap(Map<String,Object> param)throws Exception{
        return studySchoolMapper.getStudySchoolCountByMap(param);
    }

    public Integer qdtxAddStudySchool(StudySchool studySchool)throws Exception{
            //studySchool.setCreatedTime(new Date());
            return studySchoolMapper.insertStudySchool(studySchool);
    }

    public Integer qdtxModifyStudySchool(StudySchool studySchool)throws Exception{
        //studySchool.setUpdatedTime(new Date());
        return studySchoolMapper.updateStudySchool(studySchool);
    }

    public Integer qdtxDeleteStudySchoolById(String id)throws Exception{
        return studySchoolMapper.deleteStudySchoolById(id);
    }

    public Integer qdtxBatchDeleteStudySchool(String ids)throws Exception{
        Map<String,List<String>> param=new HashMap<String,List<String>>();
        String[] paramArrays=ids.split(",");
        List<String> idList=new ArrayList<String>();
            for (String temp:paramArrays){
                idList.add(temp);
            }
        param.put("ids",idList);
        return studySchoolMapper.batchDeleteStudySchool(param);
    }


}
